/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ControlPanelNonMember.java
 *
 * Created on Apr 2, 2012, 2:23:43 PM
 */
package pacificlms.MainPanel;

import javax.swing.Icon;
import javax.swing.ImageIcon;


/**
 * This panel contains the functions that non-members can invoke
 * @author brianhhh
 */
public class ControlPanelNonMember extends javax.swing.JPanel {

    /** Creates new form ControlPanelNonMember */
    public ControlPanelNonMember() {
        initComponents();
        
        try
        {
            java.net.URL IconURL1 = getClass().getResource("/icons/search.png");
            Icon icn1 =  new ImageIcon(IconURL1);
            btnSreachResource.setIcon(icn1);    

            java.net.URL IconURL2 = getClass().getResource("/icons/join.png");
            Icon icn2 =  new ImageIcon(IconURL2);
            btnJoinLibrary.setIcon(icn2);        
        }
        catch(Exception Ex)
        {
            System.err.println("Unable to load images");
        }
                
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnSreachResource = new javax.swing.JButton();
        btnJoinLibrary = new javax.swing.JButton();

        setMaximumSize(new java.awt.Dimension(146, 537));
        setMinimumSize(new java.awt.Dimension(146, 537));
        setPreferredSize(new java.awt.Dimension(146, 537));
        setLayout(null);

        btnSreachResource.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        btnSreachResource.setText("Resource Search");
        btnSreachResource.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSreachResourceActionPerformed(evt);
            }
        });
        add(btnSreachResource);
        btnSreachResource.setBounds(0, 0, 146, 21);

        btnJoinLibrary.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        btnJoinLibrary.setText("Join Library");
        btnJoinLibrary.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnJoinLibraryActionPerformed(evt);
            }
        });
        add(btnJoinLibrary);
        btnJoinLibrary.setBounds(0, 29, 146, 21);
    }// </editor-fold>//GEN-END:initComponents

    /** Search for resource */
    private void btnSreachResourceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSreachResourceActionPerformed
        MainPanel.GetMainPanel().AddCentralUIPanel(new SearchForResource(false));
    }//GEN-LAST:event_btnSreachResourceActionPerformed

    //fixme add a functionto validate the member id
    /** Join the library */
    private void btnJoinLibraryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnJoinLibraryActionPerformed
        MainPanel.GetMainPanel().AddCentralUIPanel(new InformationMember(null));
    }//GEN-LAST:event_btnJoinLibraryActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnJoinLibrary;
    private javax.swing.JButton btnSreachResource;
    // End of variables declaration//GEN-END:variables
}
